Skip to content

Instantly share code, notes, and snippets.

@selfawaresoup
selfawaresoup / uconsole.md
Last active May 14, 2024 11:36
Notes for Clockwork uConsole setup

uConsole Notes

Batteries

I use two XTAR 16850-3500 cells and I get about 8h of active usage out of them.

Get GNOME Shell and GDM3

sudo apt install gnome-shell gdm3
@rgreenjr
rgreenjr / postgres_queries_and_commands.sql
Last active May 14, 2024 11:33
Useful PostgreSQL Queries and Commands
-- show running queries (pre 9.2)
SELECT procpid, age(clock_timestamp(), query_start), usename, current_query
FROM pg_stat_activity
WHERE current_query != '<IDLE>' AND current_query NOT ILIKE '%pg_stat_activity%'
ORDER BY query_start desc;
-- show running queries (9.2)
SELECT pid, age(clock_timestamp(), query_start), usename, query
FROM pg_stat_activity
WHERE query != '<IDLE>' AND query NOT ILIKE '%pg_stat_activity%'
@hasansezertasan
hasansezertasan / main.py
Created May 12, 2024 01:12
How to use SQLAlchemy with numerical enums?
"""
How to use SQLAlchemy with numerical enums?
`IntEnum` class is taken from this article: [Using Python enums in SQLAlchemy models](https://michaelcho.me/article/using-python-enums-in-sqlalchemy-models/), all credits to the author.
"""
import datetime
import enum
from sqlalchemy import Integer, TypeDecorator, create_engine
@111a5ab1
111a5ab1 / i3-trackpad-notes
Created June 15, 2019 02:02
Macbook Pro trackpad configuration on i3 via xinput/libinput
# List all the input devices
xinput --list
⎡ Virtual core pointer id=2 [master pointer (3)]
⎜ ↳ Virtual core XTEST pointer id=4 [slave pointer (2)]
⎜ ↳ Broadcom Corp. Bluetooth USB Host Controller id=11 [slave pointer (2)]
⎜ ↳ bcm5974 id=13 [slave pointer (2)]
⎣ Virtual core keyboard id=3 [master keyboard (2)]
↳ Virtual core XTEST keyboard id=5 [slave keyboard (3)]
↳ Power Button id=6 [slave keyboard (3)]
@AlekseyArh
AlekseyArh / extra_host.md
Last active May 14, 2024 11:31
docker compose extra_host .env

Формат docker-compose.yml позволяет устанавливать значения по умолчанию.

${EXTRA_HOST_0:-host_0:127.0.0.1}

Таким образом, вы можете задать набор значений, которые в будущем могут быть заменены в .env.

.env

#EXTRA_HOST_0=host.docker.internal:host-gateway
#...
@oofnikj
oofnikj / answerfile
Last active May 14, 2024 11:27
Install Docker on Termux
KEYMAPOPTS="us us"
HOSTNAMEOPTS="-n alpine"
INTERFACESOPTS="auto lo
iface lo inet loopback
auto eth0
iface eth0 inet dhcp
hostname alpine
"
TIMEZONEOPTS="-z UTC"
@mickdekkers
mickdekkers / SnapshotCamera.cs
Last active May 14, 2024 11:26
Take snapshot images of Prefabs and GameObjects in Unity using Render Textures
using UnityEditor;
using UnityEngine;
using System;
using System.Collections.Generic;
using System.IO;
using System.Text.RegularExpressions;
// Object rendering code based on Dave Carlile's "Create a GameObject Image Using Render Textures" post
// Link: http://crappycoding.com/2014/12/create-gameobject-image-using-render-textures/
@plembo
plembo / firefox-bookmarks-backup-html.md
Last active May 14, 2024 11:24
Bookmarks backup to HTML for Firefox

Automatically backing up Firefox bookmarks to HTML

By default, Firefox automatically backs up your current bookmarks to a .json file under the current user profile, usually a path like ".mozilla/firefox/xxxx.default/bookmarkbackups". Some of us still like to work with the old-school HTML export instead.

To enable automatic backups of bookmarks to HTML, you need to add the following through either "about:config" or in the optional user.js config file (where customizations to prefs.js can be added). The backup will be created and then overwritten every time the browser is closed.

If doing this through about:config, search for browser.bookmarks.autoExportHTML (if it doesn't exist, create it as a boolean item), and set to true. Then create the browser.bookmarks.file item as a string item and enter the full path for the file (e.g., /home/myuser/bookmarks.html, where "myuser" is your login name on the system).

Before making the change in user.js (located at ~/.mozilla/firefox/xxx.default, if it doesn't exist c

//
// ContentView.swift
// AppleMusicLyricsPlayer
//
// Created by Magesh Sridhar on 2/5/23.
//
import SwiftUI
import AVKit